package com.smartao.base.selectitem;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.smartao.base.selecttype.Selecttype;
import com.smartao.core.dao.BaseDao;
import com.smartao.core.service.BaseEntityService;

@Service
public class SelectitemServiceImpl extends BaseEntityService<Selectitem, Long> implements SelectitemService{

	@Autowired
	private SelectitemDao selectitemDao;
	
	@Override
	protected BaseDao<Selectitem, Long> getDao() {
		return selectitemDao;
	}

	@Override
	public Selectitem findByCode(String code) {
		return selectitemDao.findByCode(code);
	}

	@Override
	public List<Selectitem> findBySelecttype(Long selecttypeId) {
		return selectitemDao.findBySelecttype(selecttypeId);
	}

	@Override
	public List<Selectitem> findBySelecttype(Selecttype selecttype) {
		return findBySelecttype(selecttype.getId());
	}

	@Override
	public List<Selectitem> findBySelecttypeCode(String code) {
		return selectitemDao.findBySelecttypeCode(code);
	}

	@Override
	public void deleteBySelecttypeId(Long selecttypeId) {
		selectitemDao.deleteByselecttypeId(selecttypeId);
	}

	@Override
	public Long countBySelecttype(Long selecttypeId) {
		return selectitemDao.countBySelecttype(selecttypeId);
	}

	@Override
	public List<Selectitem> findByParent(Long parentSelectitemId) {
		return selectitemDao.findByParent(parentSelectitemId);
	}

}
